package com.webservice.store;

import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public class Dbconnector 
{

	public Dbconnector()
	{
		
	}
	
	private static final String PROP_FILE="db.properties";
	static Properties props = new Properties();
	public static Connection getConnection() throws Exception
	{
		InputStream is = Dbconnector.class.getResourceAsStream(PROP_FILE);   
		props.load(is);
		String driver =  props.getProperty("db.driver");
		String url =  props.getProperty("db.url");
		String username = props.getProperty("db.username");
		String password =  props.getProperty("db.password");
		Class.forName(driver);
		Connection conn = DriverManager.getConnection(url, username, password);
		return conn;
	}

}
